<template>
	<view class="content">
		<view class="form-block" style="border-radius:30rpx 30rpx 0 0 ;">
			<view class="form-title">优势亮点</view>
			<textarea v-model="form.other" class="form-ctrl">
			</textarea>
		</view>
		<view class="btn" @click="handleSave">保存</view>
	</view>
</template>

<script>
	import {
		getAddition,
		submitAddition
	} from '@/api/resume.js'
	export default {
		data() {
			return {
				form: {
					other: ''
				}
			}
		},
		methods: {
			handleSave() {
				if (!this.form.other) {
					this.showToast('请填写优势亮点');
					return;
				}
				uni.showLoading({
					title: '提交中',
					mask: true
				})
				submitAddition(this.form).then(() => {
					uni.$emit('refresh', 6)
					this.showToast('保存成功', () => {
						uni.navigateBack()
					})
				})
			},
			getDetail() {
				uni.showLoading({
					title: '加载中',
					mask: true
				})
				getAddition({}).then((res) => {
					this.form.other = res?.data ?? '';
				})
			}
		},
		onLoad() {
			this.getDetail()
		}
	}
</script>

<style lang="scss">
	page {
		background: #FAFAFA;
	}

	.content {
		width: 100%;

		.btn {
			width: 350rpx;
			height: 80rpx;
			display: flex;
			justify-content: center;
			align-items: center;
			background: #FF7626;
			color: #fff;
			font-size: 28rpx;
			border-radius: 40rpx;
			margin: 0 auto;
			margin-top: 30rpx;
		}

		.form-block {
			width: 100%;
			background: #fff;
			padding: 30rpx;

			.form-title {
				font-size: 36rpx;
				font-weight: bold;
			}

			.form-ctrl {
				margin-top: 20rpx;
				width: 100%;
				height: 400rpx;
				border-radius: 20rpx;
				border: 1px solid #efefef;
				padding: 20rpx;
				box-sizing: border-box;
				box-shadow: 0 0 10px 0 #efefef;
			}
		}
	}
</style>
